
package com.yxm.springbootsecurity.controller;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.yxm.springbootsecurity.entity.Entity;
import com.yxm.springbootsecurity.entity.UserEntity;
import com.yxm.springbootsecurity.service.UserService;
import com.yxm.springbootsecurity.vo.ResponseDto;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.xml.sax.InputSource;

import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class IndexController {
	@Autowired
	private UserService userService;

	@RequestMapping("/index")
	public String index() {
		return "index";
	}

	@RequestMapping("/fileIndex")
	public String fileIndex() {
		return "fileIndex";
	}

	@RequestMapping("/xxeIndex")
	public String xxeIndex() {
		return "xxeIndex";
	}

	@RequestMapping(value = "/xssIndex", method = RequestMethod.POST)
	public String xssIndex(HttpServletRequest request,@RequestBody Entity entity) {
		request.setAttribute("name", entity.getXssValue());
		return "forward";
	}



	/**
	 * 接受頁面 參數
	 * @param request
	 * @return
	 */
	@RequestMapping("/postIndex")
	public String postIndex(HttpServletRequest request) {

		request.setAttribute("name", request.getParameter("name"));
		return "forward";
	}

}
